from wtforms import Form, BooleanField, StringField, PasswordField, validators

class RegisterationForm(Form):
    username = StringField('Username', [validators.length(min=4, max=25)])
    email = StringField('Email Address', [validators.length(min=6, max=34)])
    password = PasswordField('new Password', [validators.DataRequired(),
                                            validators.EqualTo('confirm', message='password must equal')])
    confirm = PasswordField('Repeat Password')
    accept_tos = BooleanField('I accept TOS', [validators.DataRequired()])

from flask import Flask, request, render_template
app = Flask(__name__)

@app.route('/register', methods=['GET', "POST"])
def register():
    form = RegisterationForm(request.form)
    if request.method == 'POST' and form.validate():
        return form.username.data + '\t' + form.email.data+ '\t' + form.password.data
    return render_template('register.html', form=form)
    

if __name__ == "__main__":
    app.run()
